View Javadoc
1   package edu.jiangxin.apktoolbox.android.dumpsys.alarm;
2   
3   import edu.jiangxin.apktoolbox.swing.treetable.MyAbstractTreeTableModel;
4   import edu.jiangxin.apktoolbox.swing.treetable.MyTreeTableModel;
5   
6   public class AlarmTreeTableDataModel extends MyAbstractTreeTableModel {
7       static protected String[] columnNames = { "Object ID", "Package", "Alarm Type", "When", "Fire DateTime" };
8   
9       static protected Class<?>[] columnTypes = { MyTreeTableModel.class, String.class, String.class, String.class, String.class };
10  
11      public AlarmTreeTableDataModel(AlarmTreeTableDataNode rootNode) {
12          super(rootNode);
13          root = rootNode;
14      }
15  
16      public Object getChild(Object parent, int index) {
17          return ((AlarmTreeTableDataNode) parent).getChildren().get(index);
18      }
19  
20  
21      public int getChildCount(Object parent) {
22          return ((AlarmTreeTableDataNode) parent).getChildren().size();
23      }
24  
25  
26      public int getColumnCount() {
27          return columnNames.length;
28      }
29  
30  
31      public String getColumnName(int column) {
32          return columnNames[column];
33      }
34  
35  
36      public Class<?> getColumnClass(int column) {
37          return columnTypes[column];
38      }
39  
40      public Object getValueAt(Object node, int column) {
41          switch (column) {
42              case 0:
43                  return ((AlarmTreeTableDataNode) node).getObjectId();
44              case 1:
45                  return ((AlarmTreeTableDataNode) node).getAppPackage();
46              case 2:
47                  return ((AlarmTreeTableDataNode) node).getAlarmType();
48              case 3:
49                  return ((AlarmTreeTableDataNode) node).getWhen();
50              case 4:
51                  return ((AlarmTreeTableDataNode) node).getFireDateTime();
52              default:
53                  break;
54          }
55          return null;
56      }
57  
58      public boolean isCellEditable(Object node, int column) {
59          return true; // Important to activate TreeExpandListener
60      }
61  
62      public void setValueAt(Object aValue, Object node, int column) {
63      }
64  }